<?php
declare (strict_types = 1);

namespace app\controller;


use app\common\model\AdboardCate;
use app\common\model\Ad;
use app\common\model\Iplog;
use think\facade\View;

class AdminIpLog extends AdminInit
{
    public function __construct()
    {
        parent::__construct();

    }
    /**
     * 显示资源列表
     *
     * @return \think\Response
     */
    public function index()
    {
        $keyword = request()->param("keyword");
        $search_field = request()->param("search_field");
        if($keyword && $search_field){
            if ($search_field == 'id'){
                $where[] = ["{$search_field}",'=',"{$keyword}"];
            }else{
                $where[] = ["{$search_field}",'like',"%{$keyword}%"];
            }
        }
        if(!isset($where)){
            $where = 1;
        }
        $list = Iplog::where($where)
            ->order("id DESC")
            ->paginate(["query"=>request()->param()]);
        //echo Ad::getlastsql();die;
        View::assign("list",$list);
        return  view();
    }




}
